$(function(){
    var token = sessionStorage.getItem("token");
    $(".cd_check").click(function(){
        var meet_id= $(".meet_id").val()
        var checkedLength = "";
        var deletelid = [];
        var ck=$(".w_kq_list input[name=selectAll1]")
        //得到一组checkbox  相当于数组
        //循环这一组checkbox让每一个checkbox选中
        for(var i=0;i<ck.length;i++){
            if(ck[i].checked==true){//委员选中
                deletelid.push(ck[i].value);
                checkedLength=deletelid.length
            }
        }
       console.log(checkedLength)
       if (checkedLength <= 0){
            $(".show_desc").html("选择要操作的内容");
            $('#my-alert').modal({target: '#my-alert'});
           return false;
       }
       else{
            $.ajax({
                    url: testurl+"/meeting/attend/pc",
                    type:"post",
                    async: false,
                    headers: { "Authorization": "Bearer " + token},
                    contentType: "application/json",
                    data:JSON.stringify({
                        "meeting_id":meet_id,//会议id
                        "attend_status":"2",//1签到 2迟到 3早退 4缺席
                        "user_ids":deletelid.toString() //用户id串
                    }),
                    success:function(data){
                        console.log(data)
                        if (data.success == true) {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                            $('#modalz').modal('close');
                        }else {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                        }
                    }
            })
       }
    })
    $(".qd_check").click(function(){
        var meet_id= $(".meet_id").val()
        var checkedLength = "";
        var deletelid = [];
        var ck=$(".w_kq_list input[name=selectAll1]")
        //得到一组checkbox  相当于数组
        //循环这一组checkbox让每一个checkbox选中
        for(var i=0;i<ck.length;i++){
            if(ck[i].checked==true){//委员选中
                deletelid.push(ck[i].value);
                checkedLength=deletelid.length
            }
        }
       console.log(checkedLength)
       if (checkedLength <= 0){
            $(".show_desc").html("选择要操作的内容");
            $('#my-alert').modal({target: '#my-alert'});
           return false;
       }
       else{
            $.ajax({
                    url: testurl+"/meeting/attend/pc",
                    type:"post",
                    async: false,
                    headers: { "Authorization": "Bearer " + token},
                    contentType: "application/json",
                    data:JSON.stringify({
                        "meeting_id":meet_id,//会议id
                        "attend_status":"1",//1签到 2迟到 3早退 4缺席
                        "user_ids":deletelid.toString() //用户id串
                    }),
                    success:function(data){
                        console.log(data)
                        if (data.success == true) {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                            $('#modalz').modal('close');
                        }else {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                        }
                    }
            })
       }
    })
    $(".zt_check").click(function(){
        var meet_id= $(".meet_id").val()
        var checkedLength = "";
        var deletelid = [];
        var ck=$(".w_kq_list input[name=selectAll1]")
        //得到一组checkbox  相当于数组
        //循环这一组checkbox让每一个checkbox选中
        for(var i=0;i<ck.length;i++){
            if(ck[i].checked==true){//委员选中
                deletelid.push(ck[i].value);
                checkedLength=deletelid.length
            }
        }
       console.log(checkedLength)
       if (checkedLength <= 0){
            $(".show_desc").html("选择要操作的内容");
            $('#my-alert').modal({target: '#my-alert'});
           return false;
       }
       else{
            $.ajax({
                    url: testurl+"/meeting/attend/pc",
                    type:"post",
                    async: false,
                    headers: { "Authorization": "Bearer " + token},
                    contentType: "application/json",
                    data:JSON.stringify({
                        "meeting_id":meet_id,//会议id
                        "attend_status":"3",//1签到 2迟到 3早退 4缺席
                        "user_ids":deletelid.toString() //用户id串
                    }),
                    success:function(data){
                        console.log(data)
                        if (data.success == true) {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                            $('#modalz').modal('close');
                        }else {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                        }
                    }
            })
       }
    })
    $(".qx_check").click(function(){
        var meet_id= $(".meet_id").val()
        var checkedLength = "";
        var deletelid = [];
        var ck=$(".w_kq_list input[name=selectAll1]")
        //得到一组checkbox  相当于数组
        //循环这一组checkbox让每一个checkbox选中
        for(var i=0;i<ck.length;i++){
            if(ck[i].checked==true){//委员选中
                deletelid.push(ck[i].value);
                checkedLength=deletelid.length
            }
        }
       console.log(checkedLength)
       if (checkedLength <= 0){
            $(".show_desc").html("选择要操作的内容");
            $('#my-alert').modal({target: '#my-alert'});
           return false;
       }
       else{
            $.ajax({
                    url: testurl+"/meeting/attend/pc",
                    type:"post",
                    async: false,
                    headers: { "Authorization": "Bearer " + token},
                    contentType: "application/json",
                    data:JSON.stringify({
                        "meeting_id":meet_id,//会议id
                        "attend_status":"4",//1签到 2迟到 3早退 4缺席
                        "user_ids":deletelid.toString() //用户id串
                    }),
                    success:function(data){
                        console.log(data)
                        if (data.success == true) {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                            $('#modalz').modal('close');
                        }else {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                        }
                    }
            })
       }
    })
    $(".qj_check").click(function(){
        var meet_id= $(".meet_id").val()
        var checkedLength = "";
        var deletelid = [];
        var ck=$(".w_kq_list input[name=selectAll1]")
        //得到一组checkbox  相当于数组
        //循环这一组checkbox让每一个checkbox选中
        for(var i=0;i<ck.length;i++){
            if(ck[i].checked==true){//委员选中
                deletelid.push(ck[i].value);
                checkedLength=deletelid.length
            }
        }
       console.log(checkedLength)
       if (checkedLength <= 0){
            $(".show_desc").html("选择要操作的内容");
            $('#my-alert').modal({target: '#my-alert'});
           return false;
       }
       else{
            $.ajax({
                    url: testurl+"/meeting/attend/pc",
                    type:"post",
                    async: false,
                    headers: { "Authorization": "Bearer " + token},
                    contentType: "application/json",
                    data:JSON.stringify({
                        "meeting_id":meet_id,//会议id
                        "attend_status":"6",//1签到 2迟到 3早退 4缺席
                        "user_ids":deletelid.toString() //用户id串
                    }),
                    success:function(data){
                        console.log(data)
                        if (data.success == true) {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                            $('#modalz').modal('close');
                        }else {
                            $(".show_desc").html(data.message);
                            $('#my-alert').modal({target: '#my-alert'});
                        }
                    }
            })
       }
    })
})